{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# [1] Matplotlib Pyplot - plot() 函数\n",
    "# Pyplot 是 Matplotlib 的子库，提供了和 MATLAB 类似的绘图 API。\n",
    "#\n",
    "'''\n",
    "plot() 用于画图它可以绘制点和线，语法格式如下：\n",
    "\n",
    "# 画单条线\n",
    "plot([x], y, [fmt], *, data=None, **kwargs)\n",
    "# 画多条线\n",
    "plot([x], y, [fmt], [x2], y2, [fmt2], ..., **kwargs)\n",
    "\n",
    "参数说明：\n",
    "x, y        点或线的节点, x 为 x 轴数据, y 为 y 轴数据，数据可以列表或数组。\n",
    "fmt         可选，定义基本格式（如颜色、标记和线条样式）。\n",
    "**kwargs    可选，用在二维平面图上，设置指定属性，如标签，线的宽度等。\n",
    "'''\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "\n",
    "xpoints = np.array([1, 2, 6, 8])\n",
    "ypoints = np.array([3, 8, 1, 10])\n",
    "\n",
    "plt.plot(xpoints, ypoints)\n",
    "plt.plot(xpoints, ypoints, 'o')\n",
    "plt.show()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# [2] Matplotlib Pyplot - plot(x, y, x, z)\n",
    "#\n",
    "x = np.arange(0.0, 4*np.pi, 0.1)   # start,stop,step\n",
    "y = np.sin(x)\n",
    "z = np.cos(x)\n",
    "w = x+np.cos(x)\n",
    "# plt.plot(x, y)\n",
    "# plt.plot(x, z)\n",
    "# plt.plot(x, w)\n",
    "plt.plot(x, y, x, z, x, w)\n",
    "plt.show()\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.9 (tags/v3.9.9:ccb0e6a, Nov 15 2021, 18:08:50) [MSC v.1929 64 bit (AMD64)]"
  },
  "orig_nbformat": 4,
  "vscode": {
   "interpreter": {
    "hash": "cf18841ace8313d0bc088ca146c17a6c0040e82121d5cb75c0ea07172309253d"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
